All Questions
497 questions
2votes
0answers
123views
When Should We Separate DTOs from REST API Serialization Classes? [closed]
We know that combining a domain entity, a DTO, and a REST API serialization class into one won't pass code review: @JsonInclude(JsonInclude.Include.NON_NULL) @Data @Builder @Entity @Table(name = "...
1vote
1answer
206views
Best way to merge files in java [closed]
I have a task to merge set of files and each file contains words ( separated by new line ). Files contains words in sorted order. Once merged all the files, it needs to preserve the sorted order. ...
1vote
4answers
413views
Preventing payment to be processed twice
I have app with paymemt/subscription service, pretty much how the payment works is: Initial payment User initiate payment on the web ( click on "subscribe") Back-End send init request to ...
1vote
1answer
149views
Background thread processing vs queue based processing for relatively short tasks (max 30-40 seconds)
I need suggestion / recommendation on the design approaches mentioned below. UseCase: I have a usecase where a client uses my system to generate some recommendations. Now, these recommendations are ...
-1votes
2answers
138views
Should uniqueness validation be on the database level or backend codebase level in data import
There is a kinda ETL task of importing data from csv to the database in project with legacy codebase and legacy database**. Data should be validated before persisting to database. Validation includes ...
1vote
7answers
482views
How do I cleanly keep track of the type of various objects implementing a common interface without reflection?
In my multiplayer game I keep track of each player's inventory. I have a class for each inventory action that extends the abstract class InventoryItem. I then polymorphically call use() on the ...
0votes
2answers
756views
Should Value Objects be used inside the DTO?
After reading about Value Objects, I think they're pretty cool and should be used, but I am not sure if I am doing it the right way. Let's assume that I have a simple DTO to create a user, which ...
1vote
2answers
127views
How do I reduce number of FieldValidator derivations?
I am trying to write RSQL Parser which checks if the RSQL is logically correct. while the RSQL Java library checks whether the RSQL expression is grammatically correct, it doesn't check if the ...
3votes
4answers
1kviews
Representing vectors as arrays of points vs. as data structures
I'm writing a program in Java where I need to represent the position, scale, and other 3-dimensional properties of objects in a world using vectors. I can use either of these two approaches: ...
0votes
1answer
85views
Design a sequential processing of records
About 10 to 15 records are processed per day with the time interval of 5 minutes between each record. System A inserts a record in DB and sends id of that record to active mq. System B Listener ...
1vote
2answers
631views
How to design an entity that has different fields depending on a type?
I have a specific domain entity that has a given type and some attributes. Based on the type, it can have another set of type-depending attributes. Normally, I would create a class for each type and ...
3votes
9answers
4kviews
Is it an anti-pattern to use interface for entity?
I read an article about that using an interface for an entity is an anti-pattern for these reasons: Your interface signature is identical to your class. There’s only one implementation of your ...
1vote
2answers
229views
Choosing a strategy for representing and handling errors (or more generally status codes) in java 8
I asked this questions on StackOverflow but it's definitely a bit too broad. Even for this website, although the question is about software design, it might not be enough "focused". I am ...
-2votes
1answer
93views
what are MVC benefits for my case?
I'm trying to design my new open source project I want to launch. I want to be very careful with design/projecting because I had trouble maintaining software in the past. I have code that works and ...
2votes
4answers
3kviews
I wrote a class with "init" method. Should I call it from other class methods? Or leave it to the object user? (Code Design)
I have a java class with an init method. It's different from the constructor. The constructor just initializes the variables/fields. The init method connects to a database and performs some ...